<?php 
session_start();
include_once('function.php');
$config = include_once('config.php');
$_POST['pwd']=md5($_POST['pwd']);
$where = "where `uname`='{$_POST['uname']}' and `pwd`='{$_POST['pwd']}'";
$res = select($config,'homeusers',$where);
$_SESSION['uname'] = $_POST['uname'];

if ($res) {
echo "<script>alert('登录成功');window.location.href='../index.php'</script>";
$_SESSION['uname'] = $_POST['uname'];
$_SESSION['islogin'] = 1;
}
else{
	echo "<script>alert('登录失败');window.location.href='dologin.php'</script>";
}
